using System.Web.Mvc;
using lab03_mastermodelabstractcontroller.Models;

namespace lab03_mastermodelabstractcontroller.Controllers
{
    public class FormController : BaseController
    {
        //
        // GET: /Form/

        public ActionResult Index()
        {
            return View();
        }

        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult Index(FormModel form)
        {
            // Validate the Form
            if (string.IsNullOrEmpty(form.Name))
                ModelState.AddModelError("name", "Please enter your name.");
            if (string.IsNullOrEmpty(form.SomeText))
                ModelState.AddModelError("someText", "Please enter some text.");

            return View();
        }

    }
}
